<template>
  <div id="DetailList">
    <v-tableTitle :btnConfig="btnConfig" @openOrders="openOrders"
                  :tableSelectData="selectData"></v-tableTitle>
    <div class="detail">
      <component :data="{detailData,argument}"
                 :is="currentComponent"></component>
    </div>
  </div>

</template>

<script>
import tableTitle from "commons/TableTitle";
import navMenu from "commons/NavMenu";
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "DetailList",
  mixins: [baseMixin],
  data () {
    return {
      newFlag: false,
      detailsFlag: false,
      argument: {},
      detailData: {},
      selectData: [],
      detailNav: "1",
      componentConfig: [
        {
          name: "detailTable",
          label: this.$t('common.detail'),
          component: () => import('./page/detailTable.vue')
        },
      ]
    }
  },
  computed: {
    btnConfig () {
        return [
          // { label: "打开订单", invalid: "openOrders" },
        ]
      },
    currentComponent () {
      return this.componentConfig[this.detailNav - 1].component;
    }
  },
  methods: {
    //进入详情
    openOrders (data) {
      console.log("选择数据  = %o" ,data);
    },
    //选中的数据
    setSelectData (data) {
      this.selectData = data;
    },
  },
  mounted () {
    
    if (Object.keys(this.$store.state.skip).length !== 0) {
      let data = this.$store.state.skip;
      this.argument = data.routeData;
      this.detailData = data.detailList;
      this.detailNav = data.detailListNav;
    } else {
      this.argument = this.$store.state.routeData;
    }
    if(this.argument.status == '0'){
      this.orderStatus = true;
    }else{
      this.orderStatus = false;
    }
  },
  components: {
    "v-tableTitle": tableTitle,
    "v-navMenu": navMenu,
  },
  watch: {
    selectData (data) {
      if (this.permissionStatus) {
        if (data.length > 0) {
          this.deleteDetailStatus = false;
        } else {
          this.deleteDetailStatus = true;
        }
      }
    }
  }
}
</script>

<style>
</style>
